%{--
This file is part of dbdjasperreport.

Copyright (C) 2008 Kue Vang aka Kou
Licensed under the Eclipse Public License, Version 1.0; 
you may not use this file except in compliance with the License. 
You may obtain a copy of the License at http://www.eclipse.org/legal/epl-v10.html 
Unless required by applicable law or agreed to in writing, software 
distributed under the License is distributed on an "AS IS" BASIS, 
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
See the License for the specific language governing permissions and limitations 
under the License.
--}%

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <meta name="layout" content="main" />
		<g:javascript library="prototype" />
		<resource:dateChooser/>
        <title>Edit Parameter</title>
    </head>
    <body>
        <div class="nav">
            <span class="menuButton"><a class="home" href="${createLinkTo(dir:'')}">Home</a></span>
            <span class="menuButton"><g:link class="list" action="list">Parameter List</g:link></span>
            <span class="menuButton"><g:link class="create" action="create">New Parameter</g:link></span>
			%{--<span class="menuButton"><g:link controller="help" action="paramhelp" target="_blank">Help</g:link></span>--}%
        </div>
        <div class="body">
            <h1>Edit Parameter</h1>
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <g:hasErrors bean="${reportParameter}">
            <div class="errors">
                <g:renderErrors bean="${reportParameter}" as="list" />
            </div>
            </g:hasErrors>
            <g:form method="post" >
                <input type="hidden" name="id" value="${reportParameter?.id}" />
                <div class="dialog">
                    <table>						
                        <tbody>							
                            <tr class="prop">							
                                <td valign="top" class="name">
                                    <label for="report">Report:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:reportParameter,field:'report','errors')}">
                                    <g:select optionKey="id" from="${Report.list()}" name="report.id" value="${reportParameter?.report?.id}" ></g:select>
									
								</td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="dataType">Data Type:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:reportParameter,field:'dataType','errors')}">
                                    <g:select name="dataTypeList.id" from="${dataTypeList}" value="${reportParameter?.dataType.encodeAsHTML()}"
									          optionKey="id" optionValue="codeDesc"
											  onchange="${remoteFunction(action:'refreshOperatorList',update:'opList',params:'\'dataTypeId=\' +this.value')}"
											  />
									
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="defaultOperator">Default Operator:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:reportParameter,field:'defaultOperator','errors')}" id="opList">
                                    <g:select  name="operatorList.id" from="${operatorList}" value="${reportParameter?.defaultOperator.encodeAsHTML()}"
											  optionKey="id" optionValue="codeDesc"/>
									
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="parameterDisplayName">Parameter Display Name:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:reportParameter,field:'parameterDisplayName','errors')}">
                                    <input type="text" maxlength="45" id="parameterDisplayName" name="parameterDisplayName" value="${fieldValue(bean:reportParameter,field:'parameterDisplayName')}"/>
									
							   </td>
								
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="parameterName">Parameter Name:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:reportParameter,field:'parameterName','errors')}">
                                    <input type="text" id="parameterName" name="parameterName" value="${fieldValue(bean:reportParameter,field:'parameterName')}"/>
									
								</td>								
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="parameterValue">Parameter Value:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:reportParameter,field:'parameterValue','errors')}">
                                    <input maxlength="255" type="text" class="orderByText" id="parameterValue" name="parameterValue" value="${fieldValue(bean:reportParameter,field:'parameterValue')}"/>
                                </td>
                            </tr> 
                                  
							<tr class="prop">
                                <td valign="top" class="name">
                                    <label for="parameterValue2">Parameter Value2:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:reportParameter,field:'parameterValue2','errors')}">
                                    <input maxlength="255" type="text" class="orderByText" id="parameterValue2" name="parameterValue2" value="${fieldValue(bean:reportParameter,field:'parameterValue2')}"/>
                                </td>
                            </tr> 
							
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="comments">Comments:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:reportParameter,field:'comments','errors')}">
                                    <textarea rows="5" cols="40" name="comments">${reportParameter?.comments?.encodeAsHTML()}</textarea>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="parameterEnded">Parameter Ended:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:reportParameter,field:'parameterEnded','errors')}">
                                    <g:select id="parameterEnded" name="parameterEnded" from="${reportParameter.constraints.parameterEnded.inList.collect{it.encodeAsHTML()}}" value="${fieldValue(bean:reportParameter,field:'parameterEnded')}" ></g:select>
                                </td>
                            </tr>                        
                        
                        </tbody>
                    </table>
                </div>
                <div class="buttons">
                    <span class="button"><g:actionSubmit class="save" value="Update" /></span>
                    <span class="button"><g:actionSubmit class="delete" onclick="return confirm('Are you sure?');" value="Delete" /></span>
                </div>
            </g:form>
        </div>
    </body>
</html>
